<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>社区文件下载</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body {
            background: linear-gradient(-45deg, #e9e2f3, #d4c9e8, #d1c9ec);
            background-size: 400% 400%;
            animation: gradient 8s ease infinite;
            min-height: 100vh;
            padding: 2rem 0;
            margin: 0;
        }
        @keyframes gradient {
            0% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
            100% { background-position: 0% 50%; }
        }
        .card {
            background-color: rgba(255, 255, 255, 0.9);
            border-radius: 12px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
            backdrop-filter: blur(5px);
            padding: 2rem;
            max-width: 900px;
            margin: 0 auto;
        }
        .card-title {
            color: #333;
            font-weight: 700;
            margin-bottom: 1.5rem;
            position: relative;
            padding-bottom: 0.5rem;
            text-align: center;
        }
        .card-title::after {
            content: '';
            width: 50px;
            height: 3px;
            background-color: #8ab4f8;
            position: absolute;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
        }
        .table {
            margin-bottom: 0;
        }
        .table th {
            color: #666;
            font-weight: 500;
        }
        .table tbody tr {
            transition: background-color 0.3s ease;
        }
        .table tbody tr:hover {
            background-color: rgba(138, 180, 248, 0.05);
        }
        .file-icon {
            color: #8ab4f8;
            font-size: 1.2rem;
            margin-right: 0.5rem;
        }
        .download-btn {
            padding: 0.3rem 0.8rem;
            font-size: 0.9rem;
            background-color: #8ab4f8;
            border-color: #8ab4f8;
        }
        .download-btn:hover {
            background-color: #6ea8f5;
            border-color: #6ea8f5;
        }
        .no-file {
            text-align: center;
            color: #999;
            padding: 3rem 0;
        }
    </style>
</head>
<body>
<div class="card">
    <h3 class="card-title">社区文件下载</h3>

    <!-- 文件列表表格 -->
    <div class="table-responsive">
        <table class="table table-hover">
            <thead class="table-light">
            <tr>
                <th>文件名</th>
                <th>文件类型</th>
                <th>文件大小</th>
                <th>上传人</th>
                <th>上传时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="file : ${files}">
                <td>
                    <i class="bi bi-file-earmark file-icon"></i>
                    <span th:text="${file.fileName}"></span>
                </td>
                <td th:text="${file.fileType}"></td>
                <td th:text="${file.fileSize}"></td>
                <td th:text="${file.uploader}"></td>
                <td th:text="${#dates.format(file.uploadTime, 'yyyy-MM-dd')}"></td>
                <td>
                    <a th:href="@{/content/file/download/{id}(id=${file.id})}" class="btn btn-sm btn-primary download-btn">
                        <i class="bi bi-download"></i> 下载
                    </a>
                </td>
            </tr>
            <tr th:if="${files.isEmpty()}">
                <td colspan="6" class="no-file">
                    <i class="bi bi-file-earmark-text" style="font-size: 3rem; color: #eee; margin-bottom: 1rem;"></i>
                    <p>暂无可下载文件，敬请期待～</p>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
</div>

<!-- 引入图标库 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>